<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>
<!--后台UI组件Start-->
<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI.jspf" %>
<%--<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI_form.jspf" %>--%>
<!--后台UI组件End-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
//-------------------------------全局变量-------------------------------------------------
            var UPDATE;
            var GRID;
            var ADD;
            $(function () {
                GRID = $("#divID_GRID").ligerGrid({
                    columns: [
                        {display: '账号', name: 'fwy_account', width: 110, align: 'left'}
                        , {display: '名称', name: 'fwy_name', width: 80, align: 'left'}
//                        , {display: '密码', hide: true, name: 'fwy_password', width: 90, align: 'left'}
//                        , {display: '锁定码', hide: true, name: 'fwy_lock', width: 90, align: 'left'}
                        , {display: '电话', name: 'fwy_tel', width: 120, align: 'left'}
                        , {display: '邮箱', name: 'fwy_email', width: 120, align: 'left'}
                        , {display: '状态', name: 'fwy_style', width: 40, align: 'left', render: function (data) {
                                switch (data.fwy_style) {
                                    case "1":
                                        return "启用";
                                    case "0":
                                        return "停用";
                                }
                            }}
                    ]
                    , usePager: false
                    , url: 'weixinkeji/dev/dc/base/user/s/selectAll.imy'
                    , width: '500px'
                    , height: '97%'
                });
                $("#toptoolbar").ligerToolBar({items: [
                        {text: '增加', click: add}
                        , {line: true}
                        , {text: '修改', click: update}
                        , {line: true}
                        , {text: '删除', click: dell}
                    ]});
            });
//-------------------------------GRID列函数-----------------------------------------------
            function f_toEmptyByMyCodeOrName() {
                $("#SELECT_ACCOUNT").val("");
                $("#SELECT_NAME").val("");
                removeMyParm();
            }
            function f_selectByMyCodeOrName() {
                removeMyParm();
                var code = $.trim($("#SELECT_ACCOUNT").val());
                var name = $.trim($("#SELECT_NAME").val());
                var style = $.trim($("#SELECT_STYLE").val());
                var andor = $.trim($("#SELECT_ANDOR").val());
                f_check(code, "fwy_account");
                f_check(name, "fwy_name");
                f_check(style, "fwy_style");
                f_check(andor, "andor");
                GRID.reload();
                function f_check(v, name) {
                    if (null == v || v.length == 0) {
                        GRID.removeParm(name);
                    } else {
                        GRID.setParm(name, v);
                    }
                }
            }
            function removeMyParm() {
                GRID.removeParm("fwy_account");
                GRID.removeParm("fwy_name");
                GRID.removeParm("fwy_style");
                GRID.removeParm("andor");
            }
//-------------------------------增删改操作-----------------------------------------------
            function add() {
                ADD = openURL_Event("添加", ADD, "dc_manager/base/user/fwy/fwy_A.jsp", 400, 900, f_d);
//                ADD.max();
                function f_d() {
                    ADD = null;
                    GRID.reload();
                }
            }
            function update() {
                var row = GRID.getSelectedRow();
                if (!row) {
                    msg_tip("错误", "请选择行");
                    return;
                } else if (row.fwy_id.length > 10) {
                    UPDATE = openURL_Event("修改", UPDATE, "weixinkeji/dev/dc/base/user/u/update.imy?_id=" + row.fwy_id, 400, 900, f_d);
//                    UPDATE.max();
                }
                function f_d() {
                    UPDATE = null;
                    GRID.reload();
                }
            }
            function dell() {
                var rows = GRID.getSelectedRows();
                var ids = "";
                for (var i = 0; i < rows.length; i++) {
                    ids = ids + "," + rows[i].fwy_id;
                }
                ids = ids.substring(1);
                if (rows.length < 1) {
                    msg_tip("操作提示", "请选择行", 200, 50);
                    return;
                } else {
                    if (post_json("weixinkeji/dev/dc/base/user/d/dell.imy", {"fwy_id": ids})) {
                        GRID.reload();
                    }
                }
            }
        </script>
    </head>
    <body>  
        <div id="toptoolbar"></div> 
        <div>
            <div id="divID_GRID" style="float: left"></div>
            <div style="float: left">
                <div style="height:255px;width: 250px; background-color: #00B83F">
                    <table>
                        <tr>
                            <td>账号</td><td><input type="text" id="SELECT_ACCOUNT" name="fwy_name"></td>  
                        </tr>
                        <tr>  
                            <td>名称</td><td><input type="text" id="SELECT_NAME" name="fwy_account"></td> 
                        </tr>
                        <tr>  
                            <td>状态</td>
                            <td>  
                                <select name="fwy_style" id="SELECT_STYLE">
                                    <option value="">不限</option>
                                    <option value="1">启用</option>
                                    <option value="0">停用</option>
                                </select>
                            </td>
                        </tr>
                        <tr>  
                            <td>条件间</td>
                            <td>  
                                <select name="fwy_andor" id="SELECT_ANDOR">
                                    <option value="1">条件之间是并且关系</option>
                                    <option value="0">条件之间是或者关系</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td></td><td><button onclick="f_selectByMyCodeOrName()">查询</button><button onclick="f_toEmptyByMyCodeOrName()">清空输入</button></td>
                        </tr>
                    </table>

                </div>
                <div id="showIMG" style="overflow:auto">

                </div>
            </div>
        </div>
    </body>
</html>
